<?php


$DIRECTORY = 'C:\Users\Naxan\Pictures\iphone icons\tab-icons\2\active';
$BEGIN = 253;
$EXTENSION = "-a.png";

$names = array();
$handle = opendir($DIRECTORY);

while (($name = readdir($handle)) !== false) {
	if ($name != "." && $name != "..") {
		$names[] = $name;
	}
}
closedir($handle);

sort($names);
echo "<pre>";
foreach ($names as $i => $name) {
	$newname = ($i+$BEGIN).$EXTENSION;
	echo "Renaming $name in $newname...\n";
	rename($DIRECTORY.'/'.$name, $DIRECTORY.'/'.$newname);
}
?>
